package com.ecreditpal.audio.netty.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.SocketUtils;

/**
 * grpc 服务端配置
 */
@Data
@Configuration
@ConfigurationProperties("netty.server")
public class NettyServerProperties {
    /**
     * Server port to listen on. Defaults to 9090.
     */
    private int port = 9090;

    /**
     * Bind address for the server. Defaults to 0.0.0.0.
     */
    private String address = "0.0.0.0";
    
    /**
     * The maximum message size allowed to be received for the server.
     */
    private int maxMessageSize;



    public int getPort() {
//        if (this.port == 0) {
//            this.port = SocketUtils.findAvailableTcpPort();
//        }
        return 36535;
    }
}
